<!--通用弹出提示框组件-->
<template>
    <div style="z-index:7777 !important;">
        <div class="shade-con" :class="(show)?('d-b'):('d-n')">
        </div>
        <div class="dialog-con" :class="(show)?('d-b'):('d-n')">
            <div class="title">{{selfTitle}}</div>
            <div class="content">
                <i class="icon icon-gantanhao"></i>
                {{selfContent}}
            </div>
            <div class="button-group">
                <button type="button" class="btn-confirm" @click="chooseSure">确定</button>
                <button type="button" class="btn-cancel" @click="chooseCancel">取消</button>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:['show', "title", "content"],
        data(){
          return {
              /*提示标题*/
              selfTitle: '提示',
              /*提示内容*/
              selfContent: '您确定要删除?'
          }
        },
        mounted(){
            this.format(this.title, this.content);
        },
        methods: {
            /*初始化弹出层*/
            format(title, content){
                if(title){this.selfTitle = title;}
                if(content){this.selfContent = content;}
            },
            /*确定*/
            chooseSure(){
                this.$emit("dialogResult", {
                    show: false,
                    choose: "ok"
                });
            },
            /*取消*/
            chooseCancel(){
                this.$emit("dialogResult", {
                    show: false,
                    choose: "cancel"
                });
            }
        }
    }
</script>

<style scoped>
    .d-n{display: none;}
    .d-b{display: block;}

    /*半透明遮罩层*/
    .shade-con{
        width:100%;
        height:100%;
        background-color: #000000;
        opacity: 0.5;
        position: fixed;
        top:0;
        left:0;
        z-index: 4444;
    }
    /*弹出层*/
    .dialog-con{
        text-align: left;
        background-color: #fff;
        width: 420px;
        border-radius: 3px;
        overflow: hidden;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        position: fixed;
        z-index: 8888;
        top:0;
        left:0;
        margin:20% 40%;
    }
    .dialog-con .title{
        margin:20px;
        font-size: 16px;
        font-weight: bold;
        color:#333333;
    }
    .dialog-con .content{
        margin:20px;
    }
    .dialog-con .content i{
        font-size: 30px;
        color: #f7ba2a;
        position: relative;
        top:5px;
        margin-right: 10px;
    }
    /*按钮组*/
    .dialog-con .button-group{
        margin:20px;
        text-align: right;
    }
    .dialog-con .button-group button{
        padding:10px 20px;
        margin-left:10px;
        cursor: pointer;
    }
    .dialog-con .button-group .btn-confirm{
        background-color: #fff;
        border:1px solid #dcdfe6;
        color:#606266;
    }
    .dialog-con .button-group .btn-cancel{
        background-color: #409EFF;
        border:1px solid #409EFF;
        color:#ffffff;
    }
</style>

